/*
 * ActionController.h
 *
 *  Created on: 09/giu/2011
 *      Author: lugas
 */

#ifndef ACTIONCONTROLLER_H_
#define ACTIONCONTROLLER_H_

#include "Aria.h"
#include "ActionGo.h"
#include "ActionTurn.h"
#include "ActionScouting.h"
#include "balloonVision.h"
#include "opencv2/imgproc/imgproc_c.h"
#include "opencv2/highgui/highgui_c.h"

/* Action that turns the robot away from obstacles detected by the
 * sonar. */
class ActionController: public ArAction {
public:
	// constructor, sets the turnThreshold, and turnAmount
	ActionController(double stopDistance, double controlAngle,
			double velocityOnTarget, ActionGo *go, ActionTurn *turn, ActionScouting *scout);
	// destructor, its just empty, we don't need to do anything
	virtual ~ActionController(void) {
	}
	;
	// fire, this is what the resolver calls to figure out what this action wants
	virtual ArActionDesired *fire(ArActionDesired currentDesired);
	// sets the robot pointer, also gets the sonar device, or deactivates this action if there is no sonar.
	virtual void setRobot(ArRobot *robot);
protected:
	// this is to hold the sonar device form the robot
	ArRangeDevice *mySonar;
	// what the action wants to do; used by the action resover after fire()
	ArActionDesired myDesired;

	double myStopDistance;
	double myControlAngle;
	double myVelocityOnTarget;
	bool target;
	//bool targetold;
	int num_target;
	ActionGo *myGo;
	ActionTurn *myTurn;
	ActionScouting *myScout;
	//double oldRange;
};


#endif /* ACTIONCONTROLLER_H_ */
